package com.team.arms.service_management_before.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.team.arms.service_management_before.domain.BeforeMilitary;
import com.team.arms.service_management_before.domain.vo.BeforeMilitaryVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Entity com.team.arms.service_management_before.domain.BeforeMilitary
 */
public interface BeforeMilitaryMapper extends BaseMapper<BeforeMilitary> {

    @Select("SELECT before_military_id ,NAME,is_fail,join_approve_id,join_inform_id\n" +
            "FROM y_before_military,b_bingyi_regist_info,b_bingyi_info\n" +
            "WHERE y_before_military.bingyi_id = b_bingyi_regist_info.bingyi_id\n" +
            "AND b_bingyi_regist_info.bingyi_info_id = b_bingyi_info.bingyi_info_id")
    List<BeforeMilitaryVo> selectList();

    @Select("SELECT before_military_id ,NAME,is_fail,join_approve_id,join_inform_id\n" +
            "FROM y_before_military,b_bingyi_regist_info,b_bingyi_info\n" +
            "WHERE y_before_military.before_military_id = #{beforeMilitaryId,jdbcType=VARCHAR}" +
            "y_before_military.bingyi_id = b_bingyi_regist_info.bingyi_id\n" +
            "AND b_bingyi_regist_info.bingyi_info_id = b_bingyi_info.bingyi_info_id")
    BeforeMilitaryVo selectBeforeMilitaryId(@Param("beforeMilitaryId") String beforeMilitaryId);

    int insertAll(BeforeMilitary beforeMilitary);

    @Select("SELECT before_military_id ,NAME,is_fail,join_approve_id,join_inform_id\n" +
            "FROM y_before_military,b_bingyi_regist_info,b_bingyi_info\n" +
            "WHERE y_before_military.bingyi_id = b_bingyi_regist_info.bingyi_id\n" +
            "AND b_bingyi_regist_info.bingyi_info_id = b_bingyi_info.bingyi_info_id\n" +
            "AND ${field} like \"%${content}%\"")
    List<BeforeMilitaryVo> selectByFiled(@Param("field") String field, @Param("content") String content);


}




